package com.ltcode.log.starter.entity;

import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;

public class DataEntity {

    private final AtomicReference<String> BizType = new AtomicReference<>();
    private final AtomicReference<String> BizNo = new AtomicReference<>();
    private final AtomicReference<String> BizUrl = new AtomicReference<>();
    private final AtomicReference<String> ReqTime = new AtomicReference<>();
    private final AtomicReference<String> ReqData = new AtomicReference<>();
    private final AtomicReference<String> RespTime = new AtomicReference<>();
    private final AtomicReference<String> RespData = new AtomicReference<>();
    private final AtomicReference<String> ErrorMsg = new AtomicReference<>();

    public DataEntity(String bizType, String bizNo, String bizUrl, String reqTime, String reqData, String respTime, String respData, String errorMsg) {
        BizType.set(bizType);
        BizNo.set(bizNo);
        BizUrl.set(bizUrl);
        ReqTime.set(reqTime);
        ReqData.set(reqData);
        RespTime.set(respTime);
        RespData.set(respData);
        ErrorMsg.set(errorMsg);
    }

    public DataEntity() {
    }

    public String getBizType() {
        return BizType.get();
    }

    public void setBizType(String bizType) {
        BizType.set(bizType);
    }

    public String getBizNo() {
        return BizNo.get();
    }

    public void setBizNo(String bizNo) {
        BizNo.set(bizNo);
    }

    public String getBizUrl() {
        return BizUrl.get();
    }

    public void setBizUrl(String bizUrl) {
        BizUrl.set(bizUrl);
    }

    public String getReqTime() {
        return ReqTime.get();
    }

    public void setReqTime(String reqTime) {
        ReqTime.set(reqTime);
    }

    public String getReqData() {
        return ReqData.get();
    }

    public void setReqData(String reqData) {
        ReqData.set(reqData);
    }

    public String getRespTime() {
        return RespTime.get();
    }

    public void setRespTime(String respTime) {
        RespTime.set(respTime);
    }

    public String getRespData() {
        return RespData.get();
    }

    public void setRespData(String respData) {
        RespData.set(respData);
    }

    public String getErrorMsg() {
        return ErrorMsg.get();
    }

    public void setErrorMsg(String errorMsg) {
        ErrorMsg.set(errorMsg);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DataEntity that = (DataEntity) o;
        return Objects.equals(BizType.get(), that.BizType.get()) &&
               Objects.equals(BizNo.get(), that.BizNo.get()) &&
               Objects.equals(BizUrl.get(), that.BizUrl.get()) &&
               Objects.equals(ReqTime.get(), that.ReqTime.get()) &&
               Objects.equals(ReqData.get(), that.ReqData.get()) &&
               Objects.equals(RespTime.get(), that.RespTime.get()) &&
               Objects.equals(RespData.get(), that.RespData.get()) &&
               Objects.equals(ErrorMsg.get(), that.ErrorMsg.get());
    }

    @Override
    public int hashCode() {
        return Objects.hash(BizType.get(), BizNo.get(), BizUrl.get(), ReqTime.get(), ReqData.get(), RespTime.get(), RespData.get(), ErrorMsg.get());
    }
}